//*****************************************************************************
//  C++: HW4
//  Shragay Dror (ID:038778445)
//  Zilber Jenia (ID:313975492)
//*****************************************************************************


#include <iostream>

#include "tContainer_t.h"

using namespace std;

int main()
{
	tContainer_t<int, vector<int*>> cnt;
	
	cout << "Is empty? " << cnt.isEmpty() << endl;
	cout << "Number of elements: " << cnt.getNumElem() << endl;
	
	cnt.insertElem(1);
	cnt.insertElem(2);
	cnt.insertElem(3);
	cnt.insertElem(4);
	cnt.insertElem(5);
	cnt.insertElem(6);
	cnt.insertElem(7);
	cnt.insertElem(8);
	cnt.insertElem(9);
	cnt.insertElem(10);

	cnt.printOut();
	
	cout << "Is empty? " << cnt.isEmpty() << endl;
	cout << "Number of elements: " << cnt.getNumElem() << endl;
	cout << "The first element is: " << *(cnt.getFirstElem()) << endl;
	cout << "The last element is: " << *(cnt.getLastElem()) << endl;
	
	int* tempP = (int*)cnt.findElem(5);
	cout << "The first element with value 5: " << ((tempP==NULL) ? (0) : (*tempP)) << endl;
	tempP = (int*)cnt.findElem(11);
	cout << "The first element with value 11: " << ((tempP==NULL) ? (0) : (*tempP)) << endl;

	tempP = (int*)cnt.removeElem(9);
	cout << "Element with value 9 removed: " << ((tempP==NULL) ? (0) : (*tempP)) << endl;
	cnt.printOut();
	tempP = (int*)cnt.removeElem(11);
	cout << "Trying to remove element with value 11: " << ((tempP==NULL) ? (0) : (*tempP)) << endl;

	cout << "Remove and delete 7: " << cnt.removeDeleteElem(7) << endl;
	cnt.printOut();
	cout << "Trying to remove and delete 11: " << cnt.removeDeleteElem(11) << endl;

	cout << "Container[0] pointing to: " << *(cnt[0]) << endl;
	cout << "Container[3] pointing to: " << *(cnt[3]) << endl;

//  cnt[20];	

	tContainer_t<int, vector<int*>> cnt1;
	cnt1.insertElem(11);
	cnt1.insertElem(12);
	cnt1.insertElem(13);
	cnt1.insertElem(14);
	cnt1.insertElem(15);
	cnt1.insertElem(16);
	cnt1.insertElem(17);
	cnt1.insertElem(18);
	cnt1.insertElem(19);
	cnt1.insertElem(20);

	cnt+=cnt1;
	cnt.printOut();
	cnt1.printOut();

	cout << "Remove all without deleting: " << cnt.removeAll() << endl;
	cout << "Print out container: ";
	cnt.printOut();


	return 0;
}